<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta charset="utf-8" />
        <title>登录-叮咚老师-园所管理后台</title>
        <meta name="description" content="User login page" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

        <!-- bootstrap & fontawesome -->
        <link rel="stylesheet" href="<?php echo base_url() ?>public/assets/css/bootstrap.css" />
        <link rel="stylesheet" href="<?php echo base_url() ?>public/assets/css/font-awesome.css" />

        <!-- text fonts -->
        <link rel="stylesheet" href="<?php echo base_url() ?>public/assets/css/ace-fonts.css" />

        <!-- ace styles -->
        <link rel="stylesheet" href="<?php echo base_url() ?>public/assets/css/ace.css" />

        <!--[if lte IE 9]>
                <link rel="stylesheet" href="<?php echo base_url() ?>public/assets/css/ace-part2.css" />
        <![endif]-->
        <link rel="stylesheet" href="<?php echo base_url() ?>public/assets/css/ace-rtl.css" />

        <!--[if lte IE 9]>
          <link rel="stylesheet" href="<?php echo base_url() ?>public/assets/css/ace-ie.css" />
        <![endif]-->

        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

        <!--[if lt IE 9]>
        <script src="<?php echo base_url() ?>public/assets/js/html5shiv.js"></script>
        <script src="<?php echo base_url() ?>public/assets/js/respond.js"></script>
        <![endif]-->
        
        <!-- basic scripts -->

        <!--[if !IE]> -->
        <script type="text/javascript">
            window.jQuery || document.write("<script src='<?php echo base_url() ?>public/assets/js/jquery.js'>" + "<" + "/script>");
        </script>

        <!-- <![endif]-->

        <!--[if IE]>
        <script type="text/javascript">
        window.jQuery || document.write("<script src='<?php echo base_url() ?>public/assets/js/jquery1x.js'>"+"<"+"/script>");
        </script>
        <![endif]-->
        <script type="text/javascript">
            if ('ontouchstart' in document.documentElement)
                document.write("<script src='<?php echo base_url() ?>public/assets/js/jquery.mobile.custom.js'>" + "<" + "/script>");
        </script>

        <!-- inline scripts related to this page -->
    </head>

    <body class="login-layout">
        <div class="main-container">
            <div class="main-content">
                <div class="row">
                    <div class="col-sm-10 col-sm-offset-1">
                        <div class="login-container">
                            <div class="center">
                                <h1>
                                    <i class="ace-icon fa fa-user green"></i>
                                    <span class="red">叮咚老师</span>
                                    <span class="white" id="id-text2">园所管理后台</span>
                                </h1>
                                <!-- <h4 class="blue" id="id-company-text">&copy;</h4> -->
                            </div>

                            <div class="space-6"></div>

                            <div class="position-relative">
                                <div id="login-box" class="login-box visible widget-box no-border">
                                    <div class="widget-body">
                                        <div class="widget-main">
                                            <h4 class="header blue lighter bigger">
                                                管理员登录
                                            </h4>

                                            <div class="space-6"></div>

                                            <form action="" method="post" id="form">
                                                <fieldset>
                                                    <label class="block clearfix">
                                                        <span class="block input-icon input-icon-right">
                                                            <input type="text" name="username" id="username" value="<?php echo set_value('username');?>" class="form-control" placeholder="用户名" />
                                                            <i class="ace-icon fa fa-user"></i>
                                                            <div class="red"><?php echo form_error('username');?></div>
                                                        </span>
                                                    </label>

                                                    <label class="block clearfix">
                                                        <span class="block input-icon input-icon-right">
                                                            <input type="password" name="password" id="password" value="<?php echo set_value('password');?>" class="form-control" placeholder="密码" />
                                                            <i class="ace-icon fa fa-lock"></i>
                                                            <div class="red"><?php echo form_error('password');?></div>
                                                        </span>
                                                    </label>
                                                    
                                                    <div class="clearfix">
														<input style="width: 100px; display:inline;" name="code" id="code" type="text" class="form-control" placeholder="验证码" />
														<img src="<?php echo base_url() ?>nursery/login/captcha?<?php echo time();?>" id="captcha"/>
														<div class="red"><?php echo form_error('code');?></div>
													</div>
													
                                                    <div class="space"></div>
                                                    <div class="clearfix">
                                                        
                                                        <button type="submit" class="width-35 pull-right btn btn-sm btn-primary submit">
                                                            <i class="ace-icon fa fa-key"></i>
                                                            <span class="bigger-110">登录</span>
                                                        </button>
                                                    </div>

                                                    <div class="space-4"></div>
                                                </fieldset>
                                            </form>
                                        </div><!-- /.widget-main -->
                                    </div><!-- /.widget-body -->
                                </div><!-- /.login-box -->
                            </div><!-- /.position-relative -->

                        </div>
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.main-content -->
        </div><!-- /.main-container -->

        
        <script type="text/javascript">
        $(function(){
        	function getError( _this,error ){	
        		_this.siblings(".red").remove();
        		_this.parent().append('<div class="red">'+error+'</div>');	
        	}
        	
        	function showError( _this,error ){
        		_this.parent().append('<div class="red">'+error+'</div>');
        	}
        	
        	function check( _this,error,re ){
        		
        		_this.siblings(".red").remove();
        		 
        		if( re ){
        			if( re.test(_this.val()) == false ){
        				showError( _this,error );		
        				return false;
        			}	
        			return true;
        		}else{		
        			if( _this.val() == '' ){
        				showError( _this,error );
        				return false;
        			}
        			return true;
        		}
        	}
        	
        	var usernameReg = /^\w+([-+.]\w+)$/;
        	var mobileReg = /^(13|15|18|17)[0-9]{9}$/;
        	
        	$('#captcha').click( function(){
        		$(this).attr( 'src','<?php echo base_url();?>nursery/login/captcha?'+Math.random());
        	});
        	
        	$('#username').on( 'blur',function(){ check( $(this),"管理员账号不能为空！") });
            
            $('#password').on( 'blur',function(){ check( $(this),"管理员密码不能为空！") });
            
            $('#code').on( 'blur',function(){ check( $(this),"验证码不能为空！") });
            
            $( '#form' ).on( 'submit',function(){ 
            	
            	if( !check( $('#username'),"管理员账号不能为空！") ) return false;
            	if( !check( $('#password'),"管理员密码不能为空！") ) return false;   
            	
            	if( !check( $('#code'),"验证码不能为空！") ) return false;
            });
        	
        });
        </script>
    </body>
</html>
